package per.jdz.demo.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import per.jdz.demo.domain.entity.PumpRecord;
import per.jdz.demo.domain.vo.reponse.ApiResult;
import per.jdz.demo.domain.vo.reponse.PageBaseResp;
import per.jdz.demo.domain.vo.request.PumpPageReq;
import per.jdz.demo.service.PumpRecordService;

import javax.annotation.Resource;
import javax.validation.Valid;

@RequestMapping("/api/v1")
@RestController
@Api(tags = "泵站运行状况相关接口")
@Slf4j
public class PumpRecordController {

    @Resource
    private PumpRecordService pumpRecordService;

    @PostMapping("/pump-records")
    @ApiOperation("泵站运行状况列表")
    public ApiResult<PageBaseResp<PumpRecord>> page(@Valid @RequestBody PumpPageReq req) {
        PageBaseResp<PumpRecord> res = pumpRecordService.pagePumpRecords(req);
        return ApiResult.success(res);
    }
}
